from selenium import webdriver
import time

from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By



drivr= webdriver.Edge()
drivr.maximize_window()

drivr.get('https://www.jiuxian.com/')
time.sleep(10)

# 业务用例
# 1.点击请登录
drivr.find_element(By.LINK_TEXT,'请登录').click()
time.sleep(2)
# 2.点击QQ头像
drivr.find_element(By.XPATH,'//*[@id="loginform"]/div/div/div/div/div[1]/div[4]/div/a[1]/i').click()
time.sleep(5)

#进入框架
drivr.switch_to.frame(drivr.find_element(By.NAME,'ptlogin_iframe'))
# 3.点击密码登录
drivr.find_element(By.ID,'switcher_plogin').click()
time.sleep(2)
# 4.输入QQ号
drivr.find_element(By.XPATH,'//input[@id="u" and @name="u"]').send_keys('1419002374')
time.sleep(2)
# 5.输入密码
drivr.find_element(By.XPATH,'//input[@id="p" or @name="p"]').send_keys('li10140910')
time.sleep(2)
# 6.点击登录
drivr.find_element(By.XPATH,'//input[@id="login_button"]').click()